package com.example.qxfw.dysjrh.controller;

import com.example.qxfw.common.SysResult;
import com.example.qxfw.dysjrh.dto.AtmosphericDto;
import com.example.qxfw.dysjrh.entity.vo.AtmosphericVo;
import com.example.qxfw.dysjrh.service.AtmosphericService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/AtmosphericEnvironment")
@RequiredArgsConstructor
public class AtmosphericController {

    private final AtmosphericService atmosphericService;

    @RequestMapping("/getAtmospheric")
    public SysResult getAtmospheric(AtmosphericDto atmosphericDto){
        List<AtmosphericVo> atmospheric = atmosphericService.getAtmospheric(atmosphericDto);
        if (atmospheric.size() == 0 || atmospheric == null){
            return SysResult.success("该时间段或该区域的数据不存在");
        }
        return SysResult.success(atmospheric);
//        return SysResult.success(atmosphericService.getAtmospheric(atmosphericDto));
    }

}
